import redis

if '__main__' == __name__:

    # 连接本机6379端口上的redis的第0个数据库
    rdb = redis.Redis('47.95.208.117', 6379, 0, password='kNMNX86r8ro/jrp25hCANp6rogqj5I45O6bfJEILXhgN/sf2nIuIvkCMXaSyRzSyG3+OB8')

    # 用KEY'keyXXX'设置VALUE'外文文本XXX'
    r = rdb.set('keyXXX', '外文文本XXX'.encode('utf8'))
    print(r)

    # 获取KEY'keyXXX'的值
    r = rdb.get('keyXXX')
    print(r)

    # 解码
    if r is not None:
        r = r.decode('utf8')
        print(r)
